﻿using System.ComponentModel;

namespace Importer
{
  public abstract class Row
  {
    public ITable Owner { get; private set; }
    public string[] Values { get; set; }

    public object ConvertFromString(int columnIndex)
    {
      var column = Owner.Columns[columnIndex];
      return TypeDescriptor.GetConverter(column.Type).
        ConvertFromString(Values[columnIndex]);
    }

    protected Row(ITable owner)
    {
      Owner = owner;
    }
  }
}